<extend name="common:base" />
<block name="content">
    <div id="header">
        <div class="header">
            <h1 class="tit">{$site_title}</h1>
            <!--<p class="goback">-->
                <!--<a class="return" href="{:U('Index/index')}">返回</a>-->
            <!--</p>-->
        </div>
    </div>
    <div class="merchant">
        <p class="agency-goods"><a href="{:U('Good/agentgoods')}">代理商品</a></p>
        <p class="merchant-goods"><a href="{:U('Good/businessgoods')}">商家商品</a></p>
    </div>
    <div class="search">
        <span class="cate_btn"></span>
        <form class="Huiform" method="get" action="" >
            <input type="text"  placeholder="搜索.." value="{$_GET['mName']}" class="input-text"  name="mName"/>
            <input type="hidden" name="id"  value="{$_GET['id']}"/>
            <input type="hidden" name="m" value="home"/>
            <input type="hidden" name="c" value="good"/>
            <input type="hidden" name="a" value="businessgoods"/>
            <button type="submit"></button>
        </form>
    </div>
    <div class="list-goods">
        <div class="list-top">
            <p class="top-p"><a href="{:U('Good/businessgoods')}"style="color:#fff">全部分类</a></p>
            <p class="top-close"><p>
        </div>
        <volist name="categories" id="categories" key="k">
        <ul class="ul-goods">
           <li><a href="{:U('Good/businessgoods',array('id'=>$categories['id']))}">{$categories['c_name']}</a></li>
        </ul>
        </volist>
    </div>
    <div class="merchant-content">
        <notempty name="businessgoods">
        <volist name="businessgoods" id="businessgoods" key="k" >
        <dl>
            <a href="{:U('Good/goodsdetail', array('id'=>$businessgoods['id']))}">
                <dt><img src="{$businessgoods['img']}"/></dt>
                <dd>
                    <div class="agent-name">
                        <p class="goods-name">{$businessgoods['g_name']|mb_substr=0,8,'utf-8'}...
                            <label class="fright">
                                售价：<span>{$businessgoods['price']}元</span>
                            </label>
                        </p>
                    </div>
                    <p class="goods-descr">
                        {$businessgoods['info']|mb_substr=0,35,'utf-8'}...
                    </p>
                </dd>
            </a>
        </dl>
        </volist>
        <else/>
        <div class="no_data">
            <img src="{:C('__STATIC__')}{$theme}/Static/img/no_data.png" class="tip_img"/>
            <p class="tip_txt">暂时没有相关信息</p>
        </div>
        </notempty>
    </div>
    <div class="dropload-load" id="loading" style="display: none;"><span class="loading"></span>加载中...</div>
</block>
<script type="text/javascript" src="__PUBLIC__/Admin/static/ext/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/static/ext/js/jquery.form.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/layer/2.4/layer.js"></script>
<block name="CSS">
    <link rel="stylesheet" href="{:C('__STATIC__')}{$theme}/Static/{:C('css')}/merchant.css" />
</block>
<block name="JS">
    <script type="text/javascript">
        $(function () {
            $(".cate_btn").click(function () {
                $(".list-goods").addClass("list-go");
            });
            $(".top-close").click(function () {
                $(".list-goods").removeClass("list-go");
            });
            var page = 1;
            $(window).scroll(function () {
                var scrollTop = $(this).scrollTop();
                var scrollHeight = $(document).height();
                var windowHeight = $(this).height();

                if (scrollTop + windowHeight == scrollHeight) {
                    page += 1;
                    $.ajax({
                        url: "{:U('Good/morebusiness')}",
                        type: "post",
                        data: {
                            params: "{$params}",
                            page: page,
                        },
                        success: function (msg) {
                            $('#loading').show();
                            if (msg != 1) {
                                $('.merchant-content').append(msg);
                            } else {
                                $('#loading').text('没有更多的数据！');
                            }
                        }
                    });
                }
            });
        });
    </script>
</block>


